#include<iostream>
#include<signal.h>
#include<unistd.h>
#include<sys/types.h>
void my_signal(int n)
{
    std::cout<<"进程："<<getpid()<<"收到了"<<n<<"号信号"<<std::endl;
}
int main()
{
    signal(2,my_signal);

    while(1)
    {
        sleep(1);
        std::cout<<"hello world"<<std::endl;
    }
    return 0;
}